#include <dirent.h>
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <vector>

#include <mysql_connection.h>

#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

#include <pcre.h>
#include "JsonDataModel.h"
#include "include.h"

#include "windows.h"

using namespace std;


int main(int argc, char** argv)
{
	SetConsoleOutputCP(1251);
	setlocale(LC_ALL, "");
	boost::wregex r(L"[^a-zA-Zа-яА-Я0-9]");
	wstring newtext=L"";
	string str="081-10836-31 Сиена Мягкая игрушка-Мячик";
	cout << "STRING: " << str << endl;
	wstring str1(str.length(), L' ');
	copy(str.begin(), str.end(), str1.begin());
	wstring res =  boost::regex_replace(str1, r, newtext);
	wcout << L"WSTRING: " << str1 << endl;
	wcout << L"REPLACED: " <<res << endl << endl;

	return 0;

	if(argc < 2) {
		cout << "Directory name is missing" << endl;
		return 1;
	}
	DIR *dir;
	struct dirent *drnt;
	if((dir = opendir(argv[1])) == NULL) {
		cout << "Wrong name for directory" << endl;
		return 2;
	} else {
		while((drnt = readdir(dir)) != NULL) {
			string filename(drnt->d_name);
			if(filename.length() < 4)
				continue;
			if(filename.substr(filename.length() - 4) != ".csv")
				continue;
			int id_supplier = atoi(drnt->d_name);
			if(makeChecks())
				continue;
			Result res = checkPricelistTemplate(filename);
			//char* line_arr = "Не найдены все колонки для указанного типа заливки : название";
			//cout << tochar(alfanumericallowedonly(string(line_arr))) << endl;
			cout << "FINISH" << endl;
			cout << "RESULT COLUMNS NAME -> " << res.columns.price << endl;
			cout << "RESULT COLUMNS ARTICLE -> " << res.columns.article << endl;
			cout << "RESULT COLUMNS CODE -> " << res.columns.code << endl;
			cout << "RESULT COLUMNS PRICE -> " << res.columns.price << endl;
			cout << "RESULT COLUMNS RRP -> " << res.columns.rrp << endl;
			cout << "RESULT COLUMNS COMMENT -> " << res.columns.comment << endl;
			//uploadPricelist();
		}
		closedir(dir);
	}
	return 0;
}
